<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>公告详情</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript">
        function closeWin(){
            api.closeWin({
            });
        };
    </script>
</head>
<body>

    <div class="notice-detail" id='list'>
        <!-- <div class="notice-detail-t">
            <h3>金可大金融存管帐户激活（安卓系统）重要公告</h3>
            2017年8月23日
        </div>

        利用数据技术，互联网技术来降低风控成本，是金融业未来亟需解决的问题！ -->
    </div>
</body>

<script type='text/template' id='template'>
    {{~it :value:index}}
    <div class="news-list">
        <ul>
            <li tapmode onclick="notice_detail({{=value.id}})">
             {{? value.icon!=false}}
               <img src=http://www.big-wealth.com{{=value.icon}}>
              {{??}}

             {{?}}
                <dl>
                    <!-- <dt>http://app.big-wealth.com{{=value.icon}}</dt> -->
                    <dt>{{=value.title}}</dt>
                    <dd>{{=value.description}}</dd>
                </dl>
                <p>{{=value.update_time}}</p>
            </li>
        </ul>
    </div>
    {{~}}
</script>

<script type="text/javascript">

function notice_detail(n) {
    var delay = 0;
    if (api.systemType != 'ios') {
        // delay = 300;
    }

    // alert(n);
    api.openWin({
        name: 'notice_newdetail',
        url: './notice-newdetail.html',
        bounces: false,
        delay: delay,
        slidBackEnabled: true,
        vScrollBarEnabled: false,
        pageParam: {
            id: n
        }
    });
};


    apiready = function() {

        fnGetNewData();
        down_refresh();
        addObserver();

    };

    function fnGetNewData(n) {

        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        if (n) {
            page += 1;
        } else {
            page = 1;
        }

        api.ajax({
            url: webAddress + '/index.php?ctl=app_article&act=article_list',
            method: 'post',
            data: {
                values: {
                    cate_id: '5',
                    page: page
                },
            }
        }, function(ret, err) {
            if (ret) {
                var data = ret.list;
                upDataNew(data, page);
                api.refreshHeaderLoadDone();
                api.hideProgress();
            }
        });
    }

    function upDataNew(data, n) {

        var template = $api.byId('template');
        var dotFn = doT.template(template.innerHTML);
        var html = dotFn(data);
        var list = $api.byId('list');

         if (n == 1) {
            $api.html(list, html);
        } else {
          if (data == '') {
              api.toast({
                  msg: '没有更多了',
                  duration: 2000,
                  location: 'bottom'
              });
              return;
          }

            $api.append(list, html);
        }

     api.parseTapmode();
    }

    //上拉刷新监听
    function addObserver() {
        api.addEventListener({
            name: 'scrolltobottom',
            extra: {
                threshold: 0
            }
        }, function(ret, err) {
            fnGetNewData(true);
        });
    }


    // 下拉刷新
    function down_refresh() {

        api.setRefreshHeaderInfo({
            visible: true,
            // loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function(ret, err) {
            fnGetNewData();
        });
    }


</script>
</html>
